<?php
class ApiBaseController extends Controller{
    
    //key
    private $_token = "698cabb9ab27e19912a759b8c1e74378";
        
    public function init(){
        //auth server
        $this->_authServer();
    }
    
    private function _authServer(){
        $token = '';
        if(isset($_REQUEST['_token']) && ($token=$_REQUEST['_token']) && $token==$this->_token){
            //auth success
        }else{
            //401
            $error = array("error_msg"=>"Unauthorized");
            $this->_sendResponse(self::HTTP_UNAUTHORIZED,json_encode($error),'application/json');
        }
    }
}
